package ab.mes.controller;

import ab.mes.service.orderFQARecordsService;
import ab.mes.tools.Result;
import ab.mes.tools.orderFQARecordsConditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/orderFQARecords")
public class orderFQARecordsController {
    @Autowired
    private orderFQARecordsService orderFQARecordsService;

    @PostMapping("/selectAll")
    //查询所有订单FQA历史记录
    public Result selectAll(){
        Result result=new Result();
        try {
            result = orderFQARecordsService.selectAll();
        }catch (Exception e){
            result.setErrorMessage("查询订单FQA历史记录失败！");
            e.printStackTrace();
        }
        return result;
    }

    @PostMapping("/select1")
    //根据起止日期、订单编号、生产序号查询订单FQA历史记录
    public Result select1(@RequestBody orderFQARecordsConditions conditions){
        Result result=new Result();
        try {
            result = orderFQARecordsService.select1(conditions);
        }catch (Exception e){
            result.setErrorMessage("查询订单FQA历史记录失败！");
            e.printStackTrace();
        }
        return result;
    }
}
